import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Props } from './props.model';
import { SupDic } from 'lbf';

@Component({
  selector: 'app-props',
  templateUrl: './props.component.html',
  styleUrls: ['./props.component.less']
})
export class PropsComponent implements OnInit {

  @Input() props: Props = { type: '' };
  @Output() ok = new EventEmitter<any>();
  @Output() animateChange = new EventEmitter<any>();
  @Input() readonly = false;


  
  icon: any;
  drowdown = 0;

  tag = '';

  constructor(
    private supdic:SupDic
  ) { }

  ngOnInit() {

  
  }


  onChangeProp(invalid?: boolean) {
    if (invalid) {
      return;
    }
    // console.log(this.props)
    this.ok.emit(this.props);
  }
  onClickFromArrow(arrow: string) {
    this.props.data.fromArrow = arrow;
    this.drowdown = 0;
    this.onChangeProp();
  }
  onClickToArrow(arrow: string) {
    this.props.data.toArrow = arrow;
    this.drowdown = 0;
    this.onChangeProp();
  }
}
